import requests


class ZuoYe:
    #部门添加
    @classmethod
    def add_zuoye_api(cls,token,body):
        url="http://ihrm2-test.itheima.net/api/company/department"
        headers={"Content-Type":"application/json","Authorization":token}
        resp=requests.post(url=url,headers=headers,json=body)
        return resp

    #部门修改
    @classmethod
    def modification_zuoye_api(cls,token,body,dep_id):
        url=f"http://ihrm2-test.itheima.net/api/company/department/{dep_id}"
        headers={"Content-Type":"application/json","Authorization":token}
        resp = requests.put(url=url, headers=headers, json=body)
        return resp

    #部门删除
    @classmethod
    def delete_zuoye_api(cls, token, dep_id):
        url = f"http://ihrm2-test.itheima.net/api/company/department/{dep_id}"
        headers = {"Authorization": token}
        resp = requests.delete(url=url, headers=headers)
        return resp

    #部门查看
    @classmethod
    def querp_zuoye_api(cls, token,dep_id):
        url = f"http://ihrm2-test.itheima.net/api/company/department/{dep_id}"
        headers = {"Authorization": token}
        resp = requests.get(url=url, headers=headers)
        return resp